package org.smartboot.flow.manager;

import org.smartboot.flow.core.EngineContext;
import org.smartboot.flow.core.ExecutionListenerSupport;

/**
 * 由管理模块进行Listener的注册
 *
 * @author qinluo
 * @date 2023/1/30 22:42
 * @since 1.0.0
 */
public class ManagerExecutionListener extends ExecutionListenerSupport {

    @Override
    public <T, S> void start(EngineContext<T, S> context) {
        TraceIdGenerator generator = TraceIdGenerator.getTraceIdGenerator();
        if (generator != null) {
            context.putExt(ManagerKeys.TRACE_ID, generator.getTraceId(context));
        }

        // 暂时init个object
        context.putExt(ManagerKeys.TRACES, new Object());

    }

    @Override
    public <T, S> void completed(EngineContext<T, S> context) {
        // 将执行采集到的数据进行上报
    }
}
